function change1(){
    $("mydiv").style.color = "red";
}
function change2(){
    $("mydiv").style = "color:red";
}

function $(id){
    return document.getElementById(id);
}

function change3(){
    $("testdiv").innerHTML = "<span style='font-weight: bold'>span内容</span>";
}

window.onload = function (){
    //得到tbody中，所有tr子元素集合
    var trArray = $("data").getElementsByTagName("tr");
    for(var i=0;i<trArray.length;i++){
        trArray[i].onclick = function (){
            trClick(this);
        }
    }
}
//引用正在变色的tr对象
var colorTr;
function trClick(trObj){
    if(colorTr != null){
        colorTr.style.backgroundColor = "white";
    }
    trObj.style.backgroundColor = "red";
    colorTr = trObj;
}